<template>
  <div class="mb10">
    <el-form
      :inline="true"
      class="demo-form-inline"
      label-width="85px"
      label-position="right"
    >
      <el-form-item label="校对时间范围：" label-width="98px">
        <div style="width: 250px">
          <SearchTime ref="searchTimeModel" @getTimes="getTimes" />
        </div>
      </el-form-item>
      <el-form-item class="ml30">
        <el-button type="primary" size="medium" @click="proofreadCondation" :disabled="isProofreading">校对</el-button>
        <el-button type="primary" plain size="medium" @click="resetCondation">重置</el-button>
        <el-button type="primary" plain size="medium" @click="cancelCondation" :disabled="!isProofreading">取消</el-button>
        <el-button type="primary" plain size="medium" @click="deleteProofread">删除</el-button>
      </el-form-item>
      <el-form-item class="progress ml30" v-show="isProofreading">
        <el-progress :percentage="percentage"></el-progress>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import SearchTime from "@/components/common/SearchTime"; // 搜索时间
// import { getCheckType } from '@/api/pacs_template' // 接口

export default {
  data() {
    return {
      isProofreading: false,
      percentage: 0,
      nowTime: []
    };
  },
  mounted() {
    setTimeout(() => {
      this.$refs.searchTimeModel.setDate();
      this.getTimes(this.$refs.searchTimeModel.time)
    }, 100);
  },
  methods: {
    // 校对
    proofreadCondation() {
      if (!this.nowTime || !this.nowTime.length) {
        this.$message.warning('请选择校对时间')
        return
      }
      this.$emit("proofread", this.nowTime);
      this.isProofreading = true;
    },
    // 重置
    resetCondation() {
      setTimeout(() => {
        this.$refs.searchTimeModel.setDate();
        this.getTimes(this.$refs.searchTimeModel.time)
      }, 100);
    },
    // 取消
    cancelCondation () {
      // this.isProofreading = false;
      this.$emit('stopProofread')
    },
    // 获取时间
    getTimes (val) {
      this.nowTime = val
    },
    deleteProofread () {
      this.$emit('deleteProofread')
    }
  },
  components: {
    SearchTime,
  },
};
</script>
<style lang="less" scoped>
.el-form-item {
  margin-bottom: 5px;
}
/deep/.el-form-item__label {
  padding-right: 0;
}
/deep/.el-button--medium {
  padding: 8px 20px;
}
.progress {
  height: 32px;
  display: inline-flex;
  align-items: center;
  /deep/.el-progress__text {
    margin-left: 25px;
  }
}
</style>
